package com.laozhao.deliveryManager.test;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

//安全卫士360界面基本实现
public class Simp360Frame extends JFrame implements ActionListener{
    Box box = Box.createHorizontalBox(); 
    JButton jb1 = new JButton("常用");
    JButton jb2 = new JButton("杀毒");
    JButton jb3 = new JButton("高级");
    JButton jb4 = new JButton("保护");
    JButton jb5 = new JButton("求 助");
    JButton jb6 = new JButton("推荐");
    //页签组件

    JTabbedPane jtp1 = new JTabbedPane();
    JPanel jp1 = new JPanel(); //实际中应该定义一个继承JPanel类来实现

    JPanel jp2 = new JPanel();
    JPanel jp3 = new JPanel();
    JPanel jp4 = new JPanel();
    JPanel jp5 = new JPanel();
    JTabbedPane jtp2 = new JTabbedPane();
    JPanel jp6 = new JPanel();
    JPanel jp7 = new JPanel();
    
    //卡片布局

    CardLayout card = new CardLayout();
    JPanel jps = new JPanel();
    public Simp360Frame()
    {
        //添加组件

        box.add(jb1);
        box.add(jb2);
        box.add(jb3);
        box.add(jb4);
        box.add(jb5);
        box.add(jb6);
        //设置页签组件布局策略，一行显示

        jtp1.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        jtp1.add("基本状态",jp1);
        jtp1.add("查杀流行木马",jp2);
        jtp1.add("清理恶评插件",jp3);
        jtp1.add("管理应用软件",jp4);
        jtp1.add("修复系统漏洞",jp5);
        
        
        jtp2.add("杀毒",jp6);
        jtp2.add("在线杀毒",jp7);
        
        jps.setLayout(card);
        jps.add("changyong",jtp1);
        jps.add("shadu",jtp2);
        
        this.add(box,BorderLayout.NORTH);
        this.add(jps,BorderLayout.CENTER);
        
        jb1.addActionListener(this);
        jb2.addActionListener(this);
        
        //展现

        this.setSize(500,400);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);
        
    }
    
    public static void main(String[] args)
    {
        new Simp360Frame();
    }

    public void actionPerformed(ActionEvent e) {
        if(e.getSource()==jb1)
        {
            card.show(jps, "changyong");
        }
        else if(e.getSource()==jb2)
        {
            card.show(jps, "shadu");
        }
    }
    
}


/*public class Simp360Frame {

}*/
